#pragma once

#include <QtWidgets/QMainWindow>
#include <qprocess.h>
#include "ui_HexJudger.h"

class HexJudger : public QMainWindow
{
	Q_OBJECT

public:
	HexJudger(QWidget *parent = Q_NULLPTR);

private:
	Ui::HexJudgerClass ui;

	//bool isEngine1Loaded = false;
	//bool isEngine2Loaded = false;
	int first = 0;
	QString engine1Filename;
	QString engine2Filename;
	QProcess * engine1;
	QProcess * engine2;
	int times = 0;
	int mode = 0;

	void killProcess(QProcess * process);
	void writeProcess(QProcess * process, const QString & str);

public slots:
	void onSetupClicked();
	void onStartClicked();
	void receiveData(QString & engine1, QString & engine2, int times, int mode, int first);
	void receiveMove(int pos, int player);
	void clearBoard();
};
